package com.turing.data.model.domain.review;

    import com.baomidou.mybatisplus.annotation.IdType;
    import com.baomidou.mybatisplus.annotation.TableId;
    import com.turing.data.vo.in.review.ForecastVO;
    import com.turing.orm.model.domain.common.BaseDo;
    import java.io.Serializable;
    import java.util.UUID;
    import java.util.stream.Collectors;

    import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
    import lombok.Builder;
    import lombok.Data;
    import lombok.EqualsAndHashCode;
    import lombok.experimental.Accessors;
    import lombok.AllArgsConstructor;
    import lombok.NoArgsConstructor;


/**
* @Description 
* @Author livin
* @Date 2022-01-19
*/
@ApiModel(value ="")
@Data
@EqualsAndHashCode(callSuper = false)
@Builder(toBuilder = true)
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class ModelContent extends BaseDo<ModelContent> {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("task_sn")
    private String taskSn;

    @TableField("child_task_sn")
    private String childTaskSn;

    @TableField("model_ele_id")
    private Integer modelEleId;

    @TableField("model_ele_name")
    private String modelEleName;

    @TableField("context")
    private String context;

    @TableField("cus_sample_id")
    private String cusSampleId;

    @TableField("degree")
    private String degree;

    @TableField("elem_truth")
    private String elemTruth;

    @TableField("end")
    private Integer end;

    @TableField("end_line_no")
    private Integer endLineNo;

    @TableField("line_no")
    private Integer lineNo;

    @TableField("page")
    private Integer page;

    @TableField("para_info")
    private String paraInfo;

    @TableField("global_pos")
    private String globalPos;

    @TableField("pos")
    private String pos;

    @TableField("pos_info")
    private String posInfo;

    @TableField("sample_id")
    private String sampleId;

    @TableField("start")
    private Integer start;

    @TableField("start_line_no")
    private Integer startLineNo;

    @TableField("text")
    private String text;

    @TableField("business_value")
    private String businessValue;

    public ModelContent(ForecastVO forecastVO) {
        this.modelEleName = forecastVO.getElem_name();
        this.globalPos = forecastVO.getGlobal_pos().toString();
        this.paraInfo = forecastVO.getPara_info().stream().map(String::valueOf).collect(Collectors.joining(","));
        this.posInfo = forecastVO.getPos_info().toString();
        this.text = forecastVO.getValue();
        this.degree = forecastVO.getDegree().toString();
        this.context = "";
        this.start = forecastVO.getGlobal_pos().get(0);
        this.end = forecastVO.getGlobal_pos().get(1);
        this.startLineNo = Integer.parseInt(forecastVO.getPara_info().get(0).split("_")[2]);
        this.endLineNo = Integer.parseInt(forecastVO.getPara_info().get(forecastVO.getPara_info().size()-1).split("_")[2]);
        this.pos = "[]";
        this.elemTruth = forecastVO.getElem_truth();
        this.lineNo = 0;
        this.page = Integer.parseInt(forecastVO.getPara_info().get(0).split("_")[1]);
        this.cusSampleId = UUID.randomUUID().toString();
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}

